<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>4-模板字符串</title>
</head>
<body>
    <script>
        //`` 键盘1左边的按键
        let str = `上海新增死亡52例 本土5487+9545`;
        console.log(str);
        let odiv = `
            <p><span>上海</span><i>本土</i></p>
        `;
        //console.log(odiv);

        //2.解析变量
        let num = 52;
        let x = 5487;
        let y = 9545;
        let sh = `上海新增死亡${num}例 本土${x}+${y}`;
        //console.log(sh);

        //在模板中可以换行
        let mobile = {
            pic:'https://img11.360buyimg.com/n7/jfs/t1/222070/34/12471/134517/622869cdE7eec4997/b50ee02a161fa972.jpg',
            title:'Apple iPhone 13 (A2634) 128GB 粉色 支持移动联通电信5G 双卡双待手机',
            price:2998
        };

        let xdiv = `
            <div>
                <img src='${mobile.pic}'/>
                <p>${mobile.title}</p>
                <p>${mobile.price}</p>
            </div>
        `;
        //alert(xdiv);
        document.body.innerHTML= xdiv;

        

    </script>
</body>
</html>